home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / bbs / mhis020.zip / CALLCRIT.MH < prev    next >
Text File  |  1996-09-20  |  2KB  |  68 lines

  1. #ifndef __CALLCRIT_MH
  2. #define __CALLCRIT_MH
  3.  
  4. #ifndef __CALLERS_MH
  5. #include "callers.mh"
  6. #endif
  7.  
  8. #ifndef __WILDCARD_MH
  9. #include "wildcard.mh"
  10. #endif
  11.  
  12. #ifndef __FINDCHAR_MH
  13. #include "findchar.mh"
  14. #endif
  15.  
  16. #ifndef __CALLINFO_MH
  17. #include "callinfo.mh"
  18. #endif
  19.  
  20. #define TITLE_WIDTH 12
  21. #define DATA_WIDTH  14
  22.  
  23. void show_data (string: title, string: data) {
  24.   if (sys.current_col + TITLE_WIDTH + DATA_WIDTH > usr.width) {
  25.     print ('\n');
  26.     };
  27.   print (COL_CYAN,     strpadleft (title + ": ", TITLE_WIDTH,' '),
  28.          COL_LMAGENTA, strpad (data, DATA_WIDTH, ' '));
  29.   }
  30.  
  31. bool meets_criteria (Ref struct _callinfo: ci, Ref struct _callcriteria: c) {
  32.   return (
  33.         matchWildcard (strupper (ci.name), strupper (c.name))
  34.     and matchWildcard (strupper (ci.city), strupper (c.city))
  35.     and ci.logon_priv >= c.min_priv
  36.     and ci.logon_priv <= c.max_priv
  37.     and (c.good_keys = "" or findAllChars (ci.logon_xkeys, strupper (c.good_keys)))
  38.     and (c.bad_keys  = "" or findAnyChars (ci.logon_xkeys, strupper (c.bad_keys)))
  39.     and ci.calls >= c.min_calls
  40.     and (c.task = -1 or c.task = ci.task)
  41.     and (c.good_flags & ci.flags = c.good_flags)
  42.     and (c.bad_flags & ci.flags = 0));
  43.   }
  44.  
  45. void show_criteria (Ref struct _callcriteria: c) {
  46.   string: temp_string;
  47.   struct _stamp: temp_stamp;
  48.  
  49.   show_data ("Name",c.name);
  50.   show_data ("City",c.city);
  51.   show_data ("Min priv", class_name (c.min_priv));
  52.   show_data ("Max priv", class_name (c.max_priv));
  53.   show_data ("Good keys", c.good_keys);
  54.   show_data ("Bad keys", c.bad_keys);
  55.   show_data ("Min calls", itostr (c.min_calls));
  56.   if (c.task = -1) {
  57.     temp_string := "all";
  58.     }
  59.   else temp_string := itostr (c.task);
  60.   show_data ("Task", temp_string);
  61.   show_data ("Good flags", flag_string (c.good_flags));
  62.   show_data ("Bad flags", flag_string (c.bad_flags));
  63.  
  64.   print ("\n");
  65.   }
  66.  
  67. #endif
  68.